<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>


<script src="../js/vue.js"></script>
<div id="app">
  <h2>{{count}}</h2>
<!--  <button v-on:click="add">+</button>-->
<!--  <button v-on:click="sub">-</button>-->
  <button @click="add">+</button>
<!--  1.事件监听的时候，2.方法不需要参数的时候，满足1.2方法可以不写括号-->
   <button @click="sub">-</button>
</div>

<script>
    const app = new Vue({
        el:'#app',
        data:{
            count:0
        },
        methods:{
          add(){
            this.count++
          },
          sub(){
            this.count--
          }
        }
    })
</script>

</body>
</html>